#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
    int num = 0;
    int n;
    long long m;
    cin >> n >> m;
    long long arr[10005]={0};
    for (int i = 1; i <= n; i++)
    {
        cin >> arr[i];
    }
    for (int j = 1; j <= n; j++)
    {
        for (int i = 1; i <n; i++)
        {
            if (arr[i] > arr[i + 1])
            {
                int temp;
                temp = arr[i];
                arr[i] = arr[i + 1];
                arr[i + 1] = temp;
            }
        }
    }

    int l = 1, k = n;

    while (1)
    {
        int x = arr[l];
        int y = arr[k];
        if (l== k)
        {
            num++;
            break;
        }
        else if (l > k)
            break;

        if (x + y > m)
        {
            num++;
            k--;
            continue;
        }
        else if (x + y <= m)
        {
            num++;
            l++;
            k--;
        }
    }

    cout << num;

    return 0;
}
